<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Struts OGNL Demo</title>
</head>
<body>
	<p>The value of "xx" is <s:property value="xx" /> </p>
	<p>The value of "msg" is <s:property value="msg" /> </p>
	
    <h3>访问OGNL上下文和Action上下文</h3>
    <p>parameters: <s:property value="#parameters.userName" /></p>
    <p>request.userName: <s:property value="#request.userName" /></p>
    <p>session.userName: <s:property value="#session.userName" /></p>
    <p>application.userName: <s:property value="#application.userName" /></p>
    <p>attr.userName: <s:property value="#attr.userName" /></p>
    
    <hr />
    <h3>用于过滤和投影（projecting）集合</h3>
    <p>Books more than $35</p>
    <ul>
        <s:iterator value="books.{?#this.price > 35}">
            <li><s:property value="title" /> - $<s:property value="price" /></li>
        </s:iterator>
    </ul>
    <p>The price of "Code Complete, Second Edition" is: 
	<s:property value="books.{?#this.title=='Code Complete, Second Edition'}.{price}[0]"/></p>
	<p>The value of "books[0]" is <s:property value="books.{?#this.title=='Code Complete, Second Edition'}.{title}[0]" /> </p>
	
	
    <hr />
    <h3>构造Map</h3>
    <s:set name="foobar" value="#{'foo1':'bar1', 'foo2':'bar2'}" />
    <p>The value of key "foo1" is <s:property value="#foobar['foo1']" /></p>
    <s:property value="#foobar['foo2']" />
    <s:property value="foobar.fool" />
    <s:property value="'xxx'" />
    
</body>
</html>
